package com.example.sls.controller.account;

import com.example.sls.service.account.ResetPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ResetPasswordController {
    @Autowired
    private ResetPasswordService resetPasswordService;

    @PostMapping("/account/resetPassword")
    public Map<String, String> resetPassword(@RequestParam Map<String, String> params){
        Map<String,Object> map = new HashMap<>();

        String username = params.get("username");
        String phone = params.get("phone");
        String password = params.get("password");
        String confirmedPassword = params.get("confirmedPassword");
        Integer roleId = Integer.valueOf(params.get("roleId"));

//        System.out.println("========");
//        System.out.println(username);
//        System.out.println(phone);
//        System.out.println(password);
//        System.out.println(confirmedPassword);
//        System.out.println(roleId);
//        System.out.println("========");


        return resetPasswordService.resetPassword(username, phone, password, confirmedPassword, roleId);
    }
}
